package com.example.cash_register.model.user;

import com.example.cash_register.controller.ErrRedirectException;
import com.example.cash_register.model.AbsValidator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class UsernameValidator extends AbsValidator {
    public String validate(String module,String redirectUrl,String username) {
        username = super.validate(module,redirectUrl,username);

        if(username.length() > 50) {
            throw new ErrRedirectException("username 长度超过50",module,redirectUrl);
        }
        return username;
    }
}
